import { Component, Vue } from 'vue-facing-decorator';
import { useModal } from '@/components/Modal';
import { BasicTable, TableAction, useTable } from '@/components/Table';
import { tableProps } from './dept.data';
import DeptModal from './dept.modal.vue';

const [registerModal, { openModal }] = useModal();
const [registerTable, { reload }] = useTable(tableProps);
/**
 * @program: microservice-central-portal
 * @description: 部门管理
 * @author: baiHoo.chen
 * @create: 2022年5月24日
 **/
@Component({ name: 'Dept', components: { DeptModal, BasicTable, TableAction } })
export default class Dept extends Vue {
  registerModal = registerModal;
  registerTable = registerTable;
  handleCreate() {
    openModal(true, {
      isUpdate: false,
    });
  }
  handleEdit(record: Recordable) {
    openModal(true, {
      record,
      isUpdate: true,
    });
  }
  handleDelete(record: Recordable) {
    console.log(record);
  }
  handleSuccess() {
    reload().then();
  }
}
